package edu.whut.jdk8.localClass;

import java.time.ZoneId;
import java.time.ZonedDateTime;

/*
ZoneDateTime类
 */
public class ZoneDateTimeDemo {
    public static void main(String[] args) {
        //默认时区下
        ZonedDateTime now = ZonedDateTime.now();
        System.out.println(now);

        //获取指定时间的ZoneDateTime对象
        ZonedDateTime zonedDateTime = ZonedDateTime.of(2008,10,1,8,0,0,0, ZoneId.systemDefault());
        System.out.println(zonedDateTime);

        //修改时间的方法
        System.out.println(now.withYear(2007));
        System.out.println(now.withMonth(7));
        System.out.println(now.withDayOfMonth(27));

        //减少、增加时间的方法
        //now.minusYears(1)
        //now.plusMouths(2)......
    }
}
